package z_exam;

import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;

/**
 * @Author: 海琳琦
 * @Date: 2022/4/7 19:28
 */
public class Test9 {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        //字符串s长度  abcaacc
        int n = sc.nextInt();
        //字符串t长度  a*c
        int m = sc.nextInt();
        String s = sc.next();
        String t = sc.next();
        int count = 0;
        List<String> list = new ArrayList<>();
        for (int i = 0; i <= n - m; i++) {
            if (t.charAt(0) == '*' || s.charAt(i) == t.charAt(0)) {
                //分割
                list.add(s.substring(i, i + m));
            }
        }
        for (String temp : list) {
            //判断temp和t
            int flag = 0;
            for (int i = 0; i < temp.length(); i++) {
                if (t.charAt(i) != '*' && temp.charAt(i) != t.charAt(i)) {
                    flag = 1;
                    break;
                }
            }
            if (flag == 0) {
                count++;
            }
        }
        System.out.println(count);
        //7 3
        //abcaacc
        //a*c
    }
}
